package com.controller.excel;

import com.controller.BaseController;
import com.controller.BaseResponse;
import com.service.excel.ExcelService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

/**
 * Created by dawn on 2017/11/21.
 */
@RestController
@RequestMapping(value = "file")
public class ExcelController extends BaseController {

    @Autowired
    private ExcelService excelService;

    // 上传文件
    @ApiOperation(value = "上传文件", notes = "上传文件")
    @PostMapping("/importFile")
    public Object importFile(@Valid @RequestBody MultipartFile file) {
        BaseResponse response = excelService.importFile(file);
        return response;
    }
}
